package net.hxz.modules.services.impl;

import java.util.List;

import net.hxz.modules.dao.NewsMapper;
import net.hxz.modules.pojo.News;
import net.hxz.modules.services.INewsService;
import net.wy.myBatisPlugin.page.model.PageRowBounds;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("newsService")
public class NewsService implements INewsService {
	
	@Autowired
	private NewsMapper newsMapper;
	
	@Override
	public List<News> list(PageRowBounds page) {
		page.setTotalRecord(newsMapper.count());
		page.setPageSize(8);
		return newsMapper.list(page);
	}

	@Override
	public News get(long newsId) {
		return newsMapper.get(newsId);
	}

	@Override
	public int add(News news) {
		return newsMapper.insert(news);
	}

	@Override
	public int mod(News news) {
		return newsMapper.update(news);
	}

	@Override
	public int del(long newsId) {
		return newsMapper.delete(newsId);
	}

}
